<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>业务合同展示</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<script type="text/javascript" src="manage/js/jquery.js">
</script>
		<script type="text/javascript" src="manage/js/addbg.js">
</script>

		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>manage/css/guanli.css"></link>
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<h2 class="tableTitle">
			业务合同展示
		</h2>
		<table class="cssrain">
			<thead>
				<tr>
					<th>
						合同名
					</th>
					<th>
						客户名
					</th>
					<th>
						合同签订时间
					</th>
					<th>
						合同概述
					</th>
					<th>
						合同金额
					</th>
					<th>
						合同开始时间
					</th>
					<th>
						合同结束时间
					</th>
					<th>
						操作
					</th>
				</tr>
			</thead>
			<tbody>
				<s:if test="!contracts.isEmpty()">
					<s:iterator value="contracts">
						<tr>
							<td>
								<s:property value="name" />
							</td>
							<td>
								<s:property value="customer" />
							</td>
							<td>
								<s:property value="date" />
							</td>
							<td>
								<s:property value="summarize" />
							</td>
							<td>
								￥
								<s:property value="amount" />
							</td>
							<td>
								<s:property value="start" />
							</td>
							<td>
								<s:property value="end" />
							</td>
							<td>
								<a href="deleteTrafficContract?contractId=${id}"
									onclick="return confirm('确定要删除吗？')">删除</a>
								<a
									href="toAlterTrafficContract?contractId=${id}&contract.name=${name}&contract.customer=${customer}&contract.date=${date}&contract.summarize=${summarize}&contract.amount=${amount}&contract.start=${start}&contract.end=${end}&contract.url=${url}">修改</a>
								<%
									String filePath = request.getAttribute("url").toString();
											String contextPath = request.getRealPath("/");
											String url = filePath.replaceFirst(
													contextPath.replaceAll("\\\\", "\\\\\\\\"), "")
													.replaceAll("\\\\", "/");
								%>
								<a href="<%=url%>" target="_blank">浏览合同源文件</a>
							</td>
						</tr>
					</s:iterator>
				</s:if>
				<s:else>
					<tr>
						<td colspan="8">没有记录</td>
					</tr>
				</s:else>
			</tbody>

			<tfoot>
				<tr>
					<td colspan="8">
						<div>
							<s:if test="page.currentPage != 1">
								<input class="firstPage"  type="button" value="首页"
									onclick="location.href='findTrafficContract?page.currentPage=1'" />
								<input class="firstPage"  type="button" value="上一页"
									onclick="location.href='findTrafficContract?page.currentPage=${page.currentPage - 1}'" />
							</s:if>
							<s:else>
								<input class="firstPage"  type="button" value="首页" disabled />
								<input class="firstPage"  type="button" value="上一页" disabled />
							</s:else>
							<s:if test="page.currentPage != page.totalPages">
								<input class="secondPage" type="button" value="下一页"
									onclick="location.href='findTrafficContract?page.currentPage=${page.currentPage + 1}'" />
								<input class="lastPage" type="button" value="尾页"
									onclick="location.href='findTrafficContract?page.currentPage=${page.totalPages}'">
							</s:if>
							<s:else>
								<input class="secondPage" type="button" value="下一页" disabled />
								<input class="lastPage" type="button" value="尾页" disabled />
							</s:else>
							<span style="margin: 0 80px 0 5px;">${page.currentPage}/${page.totalPages}</span>
							<input class="addPage" type="button" value="添加合同"
								onclick="window.location.assign('<%=basePath%>manage/trafficContract/addTrafficContract.jsp');" />
						</div>
					</td>
				</tr>
			</tfoot>
		</table>

	</body>
</html>
